package mse.eai.esb;

import java.util.HashMap;

import org.jboss.logging.Logger;
import org.jboss.soa.esb.actions.ActionLifecycle;
import org.jboss.soa.esb.actions.ActionLifecycleException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Body;
import org.jboss.soa.esb.message.Message;

public class PrepareCallIWalletMakeCreditMovementsWebService implements
		ActionLifecycle {

	private static final Logger log = Logger
			.getLogger(PrepareCallIWalletMakeCreditMovementsWebService.class);

	@Override
	public void destroy() throws ActionLifecycleException {
		// TODO Auto-generated method stub

	}

	@Override
	public void initialise() throws ActionLifecycleException {
		// TODO Auto-generated method stub

	}

	public PrepareCallIWalletMakeCreditMovementsWebService(ConfigTree config) {

	}

	public Message process(Message m) {
		log.info("ESB Action start ------>");

		log.info("Preparing the call");

		HashMap fromJBPMMap = (HashMap) m.getBody().get();

		HashMap requestMap = new HashMap();
		requestMap.put("reloadLinden.arg0", fromJBPMMap.get("uid"));
		requestMap.put("reloadLinden.arg1", fromJBPMMap.get("amount"));
		requestMap.put("reloadLinden.arg2", fromJBPMMap.get("type"));
		requestMap.put("dumpSOAP", "dumpSOAP");

		m.getBody().add(requestMap);

		log.info("Done");

		log.info("<------- ESB Action done");
		return m;

	}
}
